package com.atguigu.exercise.exer2;

public class Test{
    public Test(){
        Inner s1 = new Inner();
        s1.a = 10;
        Inner s2 = new Inner();
        s2.a = 20;
        Inner s3 = new Inner();
        System.out.println(s3.a);//20
    }
    class Inner{
        public static int a = 5;//静态变量。所有Inner对象共享同一个a的值
    }
    public static void main(String[] args) {
        Test t = new Test();//执行Test类的构造器
        Inner r = t.new Inner();
        System.out.println(r.a);//20
//        所有s1.a , s2.a, s3.a, r.a是同一份，只要有1个修改了，其余都跟着变
    }
}